<?php
/**
 * SellerUser.php
 *
 * @copyright  2023 opencart.cn - All Rights Reserved
 * @link       http://www.guangdawangluo.com
 * @author     TL <mengwb@opencart.cn>
 * @created    2023-04-18 19:36:19
 * @modified   2023-04-18 19:36:19
 */

namespace Beike\Seller\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Foundation\Auth\User as AuthUser;
use Illuminate\Notifications\Notifiable;
use Spatie\Permission\Traits\HasPermissions;
use Spatie\Permission\Traits\HasRoles;

class SellerUser extends AuthUser
{
    use HasFactory, HasRoles, HasPermissions;
    use Notifiable;

    public const AUTH_GUARD = 'web_seller';

    protected $fillable = ['seller_id', 'seller_user_group_id', 'email', 'password', 'name', 'locale', 'is_root', 'status'];

    public function seller(): BelongsTo
    {
        return $this->belongsTo(Seller::class);
    }

    public function group(): BelongsTo
    {
        return $this->belongsTo(SellerUserGroup::class, 'seller_user_group');
    }
}
